package yanglei.day0109.travel.dao.impl;


import yanglei.day0109.lottery.utils.BaseDao;
import yanglei.day0109.travel.dao.ScenicSpotDao;
import yanglei.day0109.travel.po.ScenicSpot;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author: YangLei
 * @CreateTime: 2023-01-08  15:04
 * @Description: TODO
 */
public class ScenicSpotDaoImpl extends BaseDao implements ScenicSpotDao {

    @Override
    public List<ScenicSpot> queryScenicSpotByType(Map<String, Object> map) {

        List<ScenicSpot> scenicSpots = new ArrayList<>();
        ScenicSpot scenicSpot = null;
        String sql = "select ss_name from scenic_spot";
        super.rs = super.executeQuery(sql);
        try {
            while (rs.next()){
                scenicSpot = new ScenicSpot();
                scenicSpot.setSsName(rs.getString("ss_name"));
                scenicSpots.add(scenicSpot);
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        } finally {
            super.closeAll(rs,pstmt,conn);
        }
        return scenicSpots;
    }
}
